package com.lc.common.bean.param;

import com.lc.common.bean.enums.OrderEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


/**
 * 基础排序类
 * @param <T> 字段枚举类
 * @author lc
 */
@Setter
@Getter
@ApiModel(value = "OrderParam", description = "基础排序类")
public class OrderParam<T extends Enum<T>> {
    /**
     * 排序字段
     */
    @ApiModelProperty(value = "排序字段")
    private T paramEnum;

    /**
     * 排序方式
     */
    @ApiModelProperty(value = "排序方式")
    private OrderEnum orderEnum;

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}
        if (o == null || getClass() != o.getClass()) {return false;}

        OrderParam<?> that = (OrderParam<?>) o;

        return paramEnum.equals(that.paramEnum);
    }

    @Override
    public int hashCode() {
        return paramEnum.hashCode();
    }
}
